﻿namespace NTLib.Core.Configuration
{
    using Exceptions;
    using Exceptions.Configuration;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    /// <summary>
    /// Contract that define the implementation of a configuration behavior
    /// </summary>
    public interface IConfigurable
    {
        #region Properties

        /// <summary>
        /// Gets a value indicating whether this instance is configured.
        /// </summary>
        /// <value>
        /// <c>true</c> if this instance is configured; otherwise, <c>false</c>.
        /// </value>
        /// <remarks>
        /// The value must changed after the call of LoadConfig and ResetConfig methods.
        /// </remarks>
        bool IsConfigured { get; }

        #endregion

        #region Methods

        /// <summary>
        /// Loads the configuration.
        /// </summary>
        /// <param name="configs">The configuration values.</param>
        /// <exception cref="NTLib.Core.Exceptions.Configuration.AlreadyConfiguredException">Exception raise when this method is called on an instance already configure</exception>
        /// <exception cref="ConfigurationException">You MUST only raise exception that inherite from the ConfigurationException base class</exception>
        /// <exception cref="ConfigurationFailedException">Raise this type of expression to describe why the load configuration failed.</exception>
        /// <exception cref="BadExceptionUsedException{ConfigurationException}">This exception is raised if the reset config doesn't use the ConfigurationException class.</exception>
        void LoadConfig(ConfigurationCollection configs);

        /// <summary>
        /// Resets the configuration.
        /// </summary>
        /// <exception cref="ConfigurationException"> You MUST only raise exception that inherite from the ConfigurationException base class</exception>
        /// <exception cref="ConfigurationResetFailedException">Raise this type of expression to describe why the reset failed.</exception>
        /// <exception cref="BadExceptionUsedException{ConfigurationException}">This exception is raised if the reset config doesn't use the ConfigurationException class.</exception> 
        void ResetConfig();

        #endregion
    }
}
